<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
    <style type="text/css">
        body, html {
            width: 100%;
            height: 100%;
            margin: 0;
        }

        #allmap {
            width: 100%;
            height: 700px;
        }
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=IYrcBQaaLVKXdIFjrMCAs7mOm3RcmrEI"></script>
    <script type="text/javascript"
            src="http://api.map.baidu.com/library/DistanceTool/1.2/src/DistanceTool_min.js"></script>
    <title>近地铁查看</title>
</head>
<body>
<jsp:include page="/WEB-INF/jsp/include/header.jsp"/>
<div>
    <form>
        城市:
        <select name="city">
            <c:forEach var="city" items="${fn:split(cityStr, ',')}">
                <option value="${city}" <c:if test="${param.city eq city}">selected="selected"</c:if>>
                        ${city}
                </option>
            </c:forEach>

        </select>
        日期：
        <select name="date">
            <option value="">请选择</option>
            <c:forEach var="data" items="${dates}">

                <option value="${data.field}" <c:if test="${param.date eq data.field}">selected="selected"</c:if>>
                        ${data.field}(${data.count})
                </option>
            </c:forEach>
        </select>
        <input type="submit">
        || <a href="javascript: myDis.open()">鼠标测距</a>
    </form>
</div>

<div id="allmap"></div>


</body>
</html>
<script type="text/javascript">

    // 百度地图API功能
    var map = new BMap.Map("allmap");
    var point = new BMap.Point(121.49188886, 31.2252692854);
    map.centerAndZoom(point, 8);
    map.enableScrollWheelZoom(true);

    var myDis = new BMapLib.DistanceTool(map);


    function addPoint(lng, lat, text) {
        var marker = new BMap.Marker(new BMap.Point(lng, lat)); // 创建点
        marker.enableDragging();
        marker.setLabel(new BMap.Label(text, {offset: new BMap.Size(20, -10)}));
        map.addOverlay(marker);    //增加点
    }
    <c:forEach var="point" items="${nearMetros}">
    <%--addPoint(${point.lng}, ${point.lat}, "`${point.metroLineName}`<fmt:formatNumber  value="${point.metroOffLineTime/60}"  maxFractionDigits="1"/>min");--%>
    addPoint(${point.lng}, ${point.lat}, "${point.tempText}");
    </c:forEach>

</script>

